define(function(require) {
	// var $ = require("jquery");
	var justep = require("$UI/system/lib/justep");
	var ShellImpl = require('$UI/system/lib/portal/shellImpl');
	var CommonUtils = require("$UI/system/components/justep/common/utils");
	var fn = require("$UI/ls_common/fn");
	var Model = function() {
		console.log("index.js Model");
		window.app.base_url = window.app.base_url_online;
		 
		console.log(window.app.base_url);
		
		this.callParent();
		var shellImpl = new ShellImpl(this, {
			"contentsXid" : "pages",
			"pageMappings" : {
				"Main" : {
					url : require.toUrl('./Main.w')
				},
				"Login" : {
					url : require.toUrl('./Login.w')
				},
				"Factory" : {
					url : require.toUrl('./Factory.w')
				},
			}
		});
		shellImpl.useDefaultExitHandler = false;

		CommonUtils.attachDoubleClickExitApp(function() {
			console.log("点击了物理返回键");
			console.log("当前ActiveIndex=", shellImpl.pagesComp.getActiveIndex());
			if (shellImpl.pagesComp.getActiveIndex() === 0) {
				navigator.app.exitApp();
			}
			justep.Util.hint("再按一次退出应用");
			return true;
		});
	};

	Model.prototype.modelLoad = function(event) {
		console.log("Index.js modelLoad");
		justep.Shell.showPage("Login");
		fn.fixPanelToMobile(this.comp("pages"));
	};
	return Model;
});